package cn.gson.boot.model.dao;

import cn.gson.boot.model.pojos.Business;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface BusinessDao  extends CrudRepository<Business,Integer> {

    //审核
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update business set Business_shenhe = ?1 , Business_state = ?2 where b_id=?3")
    public void shenheChuChai(String sh,String csh,Integer bId);

    //谭龙俊的客户合并（出差表查询）
    @Query(nativeQuery = true,value = "select * from business where  k_id = ?1")
    public List<Business> businesscha(Integer a);


    //谭龙俊的客户合并（合同表）
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update business set k_id = ?1 where k_id=?2")
    public void kehuhebing(Integer b,Integer a);

}
